Skip to content

Refactor PDF Generator Service Methods#364

Open
stefan-burke wants to merge 3 commits intomainfrom
claude/refactor-pdf-service-methods-011CUSiAXNSXLFq1Wk5L5QXn
Open

Refactor PDF Generator Service Methods#364
stefan-burke wants to merge 3 commits intomainfrom
claude/refactor-pdf-service-methods-011CUSiAXNSXLFq1Wk5L5QXn

Conversation

@stefan-burke
Copy link
Copy Markdown
Member

No description provided.

Extract long methods into smaller, focused helper methods across all
PDF generator service files. All methods now comply with the 20-line
maximum length standard while maintaining functionality.

Changes:
- table_builder.rb: Extract dimension building and inspector text logic
- disclaimer_footer_renderer.rb: Split footer rendering into components
- utilities.rb: Break watermark grid rendering into discrete steps
- debug_info_renderer.rb: Separate header, summary, and table rendering
- header_generator.rb: Extract unit header and expiry text rendering
- image_processor.rb: Split photo dimension calculation logic
- position_calculator.rb: Extract constraint fitting logic
- assessment_block_builder.rb: Split build method into helper methods
- assessment_block_renderer.rb: Extract fragment rendering helpers
- assessment_columns.rb: Separate column placement and content rendering
- pdf_generator_service.rb: Extract header, footer, and overlay logic

All files verified with Ruby syntax checker. Full test suite requires
libvips system dependency (not available in current environment).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Split method calls with more than 2 parameters across multiple lines
for better readability. Fixed date format string to use I18n.

Changes:
- Split multi-parameter method definitions and calls
- Fixed hardcoded date format string in utilities.rb
- Added date.formats.pdf to en.yml for I18n compliance
- Improved code formatting in header_generator.rb
- Improved code formatting in disclaimer_footer_renderer.rb
- Improved code formatting in image_processor.rb
- Extracted generate_inspection_report_content helper method

Note: pdf_generator_service.rb still has some line length violations
that need additional refactoring to fix completely.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Updated test stubs to use Rails.configuration.pdf.logo instead of
ENV["PDF_LOGO"] because the PdfConfig object is created at Rails
startup from ENV and stubbing ENV in tests doesn't affect it.

This fixes the failing test that expected 3 make_cell calls when both
signature and logo are present.

All 14 examples now pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants